import { getFocusList, getTopToday } from "@/api/adv";

const state = {
  focusList:[

  ],
  topToday:[],
};
const mutations = {
  SET_FOCUSLIST(state,focusList){
		state.focusList = focusList;
	},
  SET_TOPTODAY(state,topToday){
    state.topToday = topToday;
  }
};
const actions = {
  //获取广告列表
  async getFocusListAsync({commit}){
    const result = await getFocusList();
    // console.log(result)
    if(result.ok === 200) {
      commit('SET_FOCUSLIST',result.data)
    }
  },
  //获取今日推荐
  async getTopTodayAsync({commit}){
    const result = await getTopToday();
    if(result.ok === 200) {
      commit('SET_TOPTODAY',result.data)
    }
  }
};
const getters = {};


export default {
  state,
  mutations,
  actions,
  getters,
  namespaced:true,
}